define(function (require, exports, module) {
	var Page=require("Page");
	var Utils=require("Utils");
	
	var Detail=function(){}
	Detail.prototype=new Page();
	
	Detail.prototype.rule=null;
	Detail.prototype.ruleLoaded=false;

	
	Detail.prototype.getData=function(){
		var data={}
		return data;
	}
	
	Detail.prototype.loadRule=function(url,updateRuleNames){
		var self=this;
		var options={}
		options.url=url,
		options.dataType="json",
		options.cache=false,
		options.success=function(data, textStatus, jqXHR){
			self.rule=data;
			self.ruleLoaded=true;
			self.updateClass();
		},
		options.error=function(){
			pConsole.log("表单规则加载失败");
		};
		$.ajax(options);
	}

	
	Detail.prototype.updateClass=function(){
		var className="";
		var data=this.getData();
		for(var i in data){
			var str="var "+data[i].name+"=\""+data[i].value+"\";"
			eval(str);
		}
		var classMatchRules=this.rule.classMatchRules
		for(var i=0;i<classMatchRules.length;i++){
			try{
				var evalStr="if("+classMatchRules[i].matchStr+"){className=\""+classMatchRules[i].name+"\";}"
				eval(evalStr);
			}catch(error){
				pConsole.log("no match");
			}
		}
		this.element.className=className;
	}
	module.exports = Detail;
})